home *** CD-ROM | disk | FTP | other *** search
- /* This version (1.20) reworked for Turbo 'C' for speed */
-
- /* D. Bushong (c) 1987 All rights reserved. OK to distribute, providing
- that these comments remain intact, and that copyright notice is displayed
- intact.
- */
-
- #define MYVERSION "Version 1.20"
- #include <stdio.h>
- #include <dos.h>
- #include <hamdefs.h>
-
- void interrupt terminate(void);
- void interrupt (*oldvect)(void);
-
- char *options[] = {
- "Read WARNING message",
- "Read \"What is interleave?\"",
- "Read \"Why change interleave?\"",
- "Select the disk drive",
- "Execute interleave adjustment",
- "Exit this program",
- NULL
- };
-
-
- int drive_to_use = 0x80;
- int have_selected = 0;
- int factor;
- unsigned char s_top, s_bottom;
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- static int colarray[] = {
- 39 };
- int choice;
- char temp[80];
-
- _AX = 0x0300;
- _BX = 0;
- geninterrupt(0x10);
-
- s_top = _CH;
- s_bottom = _CL;
-
- if (argc == 2)
- sscanf(argv[1], "%d", &factor);
-
- if (factor < 1 || factor > 16 || argc != 2)
- factor = 5;
-
- clrscn();
- scrbox(0, 0, 23, 79, 2, NORMAL | HILITE);
- center(9, "RADIO KZ1O");
- center(10, "Concord, NH U.S.A. 03301");
- center(6, "Interleave Adjust Utility (IAU.EXE)");
- center(12, "(c) 1987 Dave Bushong, All Rights Reserved");
- center(13, MYVERSION);
-
- locate(17, 5);
- keyboard(); /* press a key */
-
- clrscn();
-
- oldvect = getvect(0x23);
- setvect(0x23, terminate);
-
- scrtable(0, 0, 23, 78, 3, NORMAL | HILITE, 5, 7, -1, 1, colarray);
-
- atputsa(1, 37, "Status", NORMAL | HILITE);
- atputsa(6, 15, "Selection", NORMAL | HILITE);
- atputsa(6, 54, "Information", NORMAL | HILITE);
-
- type("warning.doc", 10, 43, 20, 75);
-
- locate(9, 5);
-
- choice = 0;
- clrkey();
- while ((choice = getbar(options, choice)) != 5) {
- switch (choice) {
- case 0:
- type("warning.doc", 10, 43, 20, 75);
- break;
- case 1:
- type("ileave.doc", 10, 43, 20, 75);
- sprintf(temp, "Interleave selected: %d", factor);
- atputsha(21, 42, temp);
- break;
- case 2:
- type("change.doc", 10, 43, 20, 75);
- break;
- case 3:
- sel_disk();
- break;
- case 4:
- clrblk(12, 45, 14, 75);
- atputsha(17, 45, "Started at ");
- showtime(17, 58);
- rfw();
- atputsha(13, 45, "Complete at ");
- showtime(13, 58);
- choice = 5;
- break;
- case 5:
- cursor(TRUE);
- default:
- break;
- }
- clrblk(1, 1, 4, 77);
- atputsa(1, 37, "Status", NORMAL | HILITE);
- center(3, "Complete");
- locate(9, 5);
- clrkey();
- }
-
- locate(23, 0);
- setvect(0x23, oldvect);
- cursor(TRUE);
- exit(0);
- }
-
-
- char *pick_disk[] = {
- "Select the first hard disk drive ",
- "Select the second hard disk drive",
- NULL
- };
-
-
- sel_disk()
- {
- struct REGPACK r;
- struct SREGS sregs;
-
- int count;
- char temp[80];
-
- segread(&sregs);
- r.r_ax = 0x0800;
- r.r_bx = r.r_cx = 0;
- r.r_dx = drive_to_use;
- intr(0x13, &r);
- if (r.r_flags & 1) {
- atputsa(2, 25, "Unable to address hard disk(s)", NORMAL | HILITE);
- beep();
- return;
- }
- count = r.r_dx & 0x0f;
-
- atputsha(22, 42, "Drive selected: ");
- switch (count) {
- case 0:
- center(3, "No hard disk drives in your system");
- break;
- case 1:
- break;
- case 2:
- locate(19, 5);
- drive_to_use = 0x80 + getbar(pick_disk, 0);
- clrblk(18, 4, 22, 5 + strlen(pick_disk[0]));
- break;
- default:
- clrscn();
- atputsa(5, 5, "Congratulations! You have more than two hard", NORMAL | HILITE);
- atputsa(6, 5, "disks responding, and that BREAKS this program.", NORMAL | HILITE);
- locate(23, 0);
- setvect(0x23, oldvect);
- exit(9);
- break;
-
- }
- sprintf(temp, "%02d", drive_to_use - 0x80);
- atputsa(22, 58, temp, NORMAL | HILITE);
- have_selected = 1;
- }
-
-
- cursor(int onoff)
- {
- if (onoff)
- v_scsrtp(s_top, s_bottom);
- else
- v_scsrtp(0x20, 7);
- }
-
-